#include<stdio.h>
#include<unistd.h>
#include<signal.h>
#include<sys/wait.h>

void sigcallback(int sig){
    printf("sig recv is :%d\n",sig);
    wait(NULL);
}

int main(){
signal(SIGCHLD,sigcallback);
   int ret  =  fork();
   if(ret<0){
       perror("fork");
       return 0;
   }
   else if(ret==0){
       sleep(5);
       printf("i am child\n");
   }else {
       while(1){
       printf("i am father\n");
       sleep(1);
       }
   }
    return 0;
}
